import layoutHeaderAside from '@/layout/header-aside'

// 由于懒加载页面太多的话会造成webpack热更新太慢，所以开发环境不使用懒加载，只有生产环境使用懒加载
const _import = require('@/libs/util.import.' + process.env.NODE_ENV)

/**
 * 在主框架内显示
 */
const frameIn = [
  {
    path: '/',
    redirect: { name: 'index' },
    component: layoutHeaderAside,
    children: [
      // 首页
      {
        path: 'index',
        name: 'index',
        meta: {
          auth: true
        },
        component: _import('system/index')
      },
      {
        path: 'addassess',
        name: 'addassess',
        meta: {
          title: '添加日考核',
          auth: true
        },
        component: _import('daily/addassess')
      },
      {
        path: 'detail',
        name: 'detail',
        meta: {
          title: '日考核详情',
          auth: true
        },
        component: _import('daily/detail')
      },
      {
        path: 'summary',
        name: 'summary',
        meta: {
          title: '个人日考核汇总',
          auth: true
        },
        component: _import('daily/summary')
      },
      {
        path: 'checkassess',
        name: 'checkassess',
        meta: {
          title: '查看日考核',
          auth: true
        },
        component: _import('daily/checkassess')
      },
      {
        path: 'batchreview',
        name: 'batchreview',
        meta: {
          title: '批量审核',
          auth: true
        },
        component: _import('daily/batchreview')
      },
      // 部门考核页面
      {
        path: 'examinelist',
        name: 'examinelist',
        meta: {
          title: '部门考核列表',
          auth: true
        },
        component: _import('department/list/examinelist')
      },
      // 部门考核评分页面
      {
        path: 'score',
        name: 'score',
        meta: {
          title: '部门考核列表',
          auth: true
        },
        component: _import('department/list/score')
      },
      // 部门考核模板页面
      {
        path: 'templatelist',
        name: 'templatelist',
        meta: {
          title: '部门考核模板列表',
          auth: true
        },
        component: _import('department/template/templatelist')
      },
      // 部门考核模板新建页面
      {
        path: 'newtemplate',
        name: 'newtemplate',
        meta: {
          title: '部门新建考核模板',
          auth: true
        },
        component: _import('department/newtemplate/new')
      },
      // 公司考核模板
      {
        path: 'template',
        name: 'template',
        meta: {
          title: '考核模板',
          auth: true
        },
        component: _import('companytemplate/template')
      },
      {
        path: 'inspectlist',
        name: 'inspectlist',
        meta: {
          title: '考核列表',
          auth: true
        },
        component: _import('companyinspectlist/inspectlist')
      },
      {
        path: 'pendingTrial',
        name: 'pendingTrial',
        meta: {
          title: '待考核',
          auth: true
        },
        component: _import('selfInfo/pendingTrial')
      },
      {
        path: 'toBeAssessed',
        name: 'toBeAssessed',
        meta: {
          title: '待审核',
          auth: true
        },
        component: _import('selfInfo/toBeAssessed')
      }, // 系统 前端日志       // 个人信息
      {

        path: 'pendingTrial',
        name: 'pendingTrial',
        meta: {
          title: '审核信息',
          auth: true
        },
        component: _import('selfInfo/pendingTrial')
      },
      {
        path: 'toBeAssessed',
        name: 'toBeAssessed',
        meta: {
          title: '考核信息',
          auth: true
        },
        component: _import('selfInfo/toBeAssessed')
      }, // 考核设置
      {
        path: 'assessItem',
        name: 'assessItem',
        meta: {
          title: '考核项',
          auth: true
        },
        component: _import('assess/assessItem')
      },
      {
        path: 'assessType',
        name: 'assessType',
        meta: {
          title: '考核种类',
          auth: true
        },
        component: _import('assess/assessType')
      },
      {
        path: 'assessStandard',
        name: 'assessStandard',
        meta: {
          title: '考核指标',
          auth: true
        },
        component: _import('assess/assessStandard')
      },
      {
        path: 'addItem',
        name: 'addItem',
        meta: {
          title: '添加考核项',
          auth: true
        },
        component: _import('assess/addItem')
      },
      // 考核设置结束
      // 考核展示开始
      {
        path: 'deptdisplay',
        name: 'deptdisplay',
        meta: {
          title: '部门考核展示',
          auth: true
        },
        component: _import('ExamineList/deptdisplay')
      },
      {
        path: 'pfa_assess',
        name: 'pfa_assess',
        meta: {
          title: '绩效考核展示',
          auth: true
        },
        component: _import('ExamineList/pfa_assess')
      },
      // 考核展示结束
      // 个人信息
      {
        path: 'pendingTrial',
        name: 'pendingTrial',
        meta: {
          title: '审核信息',
          auth: true
        },
        component: _import('selfInfo/pendingTrial')
      },
      {
        path: 'toBeAssessed',
        name: 'toBeAssessed',
        meta: {
          title: '考核信息',
          auth: true
        },
        component: _import('selfInfo/toBeAssessed')
      },
      {
        path: 'reviewDetails',
        name: 'reviewDetails',
        meta: {
          title: 'test',
          auth: true
        },
        component: _import('selfInfo/toBeAssessed/reviewDetails')
      },
      // 用户管理
      {
        path: 'user',
        name: 'user',
        meta: {
          title: '用户管理',
          auth: true
        },
        component: _import('systemManager/user')
      },
      // 部门管理
      {
        path: 'deptmanager',
        name: 'deptmanager',
        meta: {
          title: '部门管理',
          auth: true
        },
        component: _import('systemManager/dept')
      },
      // 系统 前端日志
      {
        path: 'log',
        name: 'log',
        meta: {
          title: '前端日志',
          auth: true
        },
        component: _import('system/log')
      },
      // 刷新页面 必须保留
      {
        path: 'refresh',
        name: 'refresh',
        hidden: true,
        component: _import('system/function/refresh')
      },
      // 页面重定向 必须保留
      {
        path: 'redirect/:route*',
        name: 'redirect',
        hidden: true,
        component: _import('system/function/redirect')
      }
    ]
  }
]

/**
 * 在主框架之外显示
 */
const frameOut = [
  // 登录
  {
    path: '/login',
    name: 'login',
    component: _import('system/login')
  }
]

/**
 * 错误页面
 */
const errorPage = [
  {
    path: '*',
    name: '404',
    component: _import('system/error/404')
  }
]

// 导出需要显示菜单的
export const frameInRoutes = frameIn

// 重新组织后导出
export default [
  ...frameIn,
  ...frameOut,
  ...errorPage
]
